package jh.com.jhappbf.assay;

import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import jh.com.jhappbf.R;

public class AssayManager extends Fragment implements OnClickListener {

    private ImageView mAddAssayImg;
    private ImageView mQueryAssayImg;
    private ImageView mSettingAssayImg;
    private RelativeLayout mAssayAddLayout, mAssayQueryLayout;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.assay_main_activity, null);
        initView(v);
        return v;
    }

    /**
     * 初始化
     */
    private void initView(View v) {
        mAddAssayImg = v.findViewById(R.id.assay_add_img);
        mQueryAssayImg = v.findViewById(R.id.assay_query_img);
        mSettingAssayImg = v.findViewById(R.id.assay_setting_img);
        mAssayAddLayout = v.findViewById(R.id.assay_add_layout);
        mAssayQueryLayout = v.findViewById(R.id.assay_query_layout);

        mAddAssayImg.setOnClickListener(this);
        mQueryAssayImg.setOnClickListener(this);
        mSettingAssayImg.setOnClickListener(this);
        mAssayAddLayout.setOnClickListener(this);
        mAssayQueryLayout.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.assay_add_img://化验添加
            case R.id.assay_add_layout:
                Intent i = new Intent(getActivity(), AssayAddMain.class);
                getActivity().startActivity(i);
                break;
            case R.id.assay_query_img://化验查询
            case R.id.assay_query_layout:
                Intent i1 = new Intent(getActivity(), AssayQuery.class);
                getActivity().startActivity(i1);
                break;
            case R.id.assay_setting_img:
                Intent i2 = new Intent(getActivity(), AssayQuerySetting.class);
                getActivity().startActivity(i2);
                break;
            default:
                break;
        }
    }
}